<!--判断题-->
<template>
  <div class="judgeChoice">
    <el-row style="margin-top: 5px;width: 50%;padding-left: 10px">
      <el-form :model="item" :rules="rules" ref="item" label-width="60px" label-position="left">
        <el-form-item label="题目" prop="question">
          {{item.question}}
        </el-form-item>
        <el-form-item label="答案" prop="answer">
          <el-radio-group v-model="item.answer">
            <el-radio label="对">对</el-radio>
            <el-radio label="错">错</el-radio>
          </el-radio-group>
        </el-form-item>
      </el-form>
    </el-row>
  </div>
</template>

<script>
  export default {
    name: 'singleChoice',
    props: ['index','item'],
    components: {},
    data() {
      return {
        rules:{
          question: [{ required: true, message: '请输入题目', trigger: 'blur' }],
          answer: [{ required: true, message: '请选择答案', trigger: 'change' }],
        }
      }
    },
    computed: {
      isSuccess(){
        return !!(this.item.question &&  this.item.answer)
      },
      name(){
        return this.item.question
      },
      answer() {
        return this.item.answer === this.item.response
      }
    },
    methods: {
      rulesForm(){
        this.$refs['item'].validate((valid) => {
          if (valid) {
          } else {
            this.$message.info(`第${this.index}题还未输入完整`)
            return false;
          }
        });
      }
    },
    mounted() {
    },
    created() {
    },
    watch: {}
  }
</script>

<style scoped lang="scss">
  .judgeChoice {
  }
</style>

